<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <title>Document</title>
    <script src="./bower_components/knockout/dist/knockout.debug.js"></script>
    <script src="./knockout-mapping.js"></script>
</head>
<body>
     <div data-bind="foreach:data">
        <div data-bind="text:$data.fileName"></div>
     </div>
    <button onclick="changeData()"></button>

<script>
    var initValue = [{
        fileName:'file1'
    },{
        fileName:'file2'
    }];

    var initValue2 = [{
        fileName:'file3'
    },{
        fileName:'file4'
    }];

    var data = {
        name: 'Graham'
    };

    var JSONModel = function(initValue){
        this.data = ko.mapping.fromJS(initValue);
    };
    window.attachmentValue = new JSONModel(initValue);
    ko.applyBindings(window.attachmentValue);
    function changeData(){
        ko.mapping.fromJS(


                ,attachmentValue.data);
    }
</script>
</body>
</html>